﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Garlic.CC.BaseClass;
using Garlic.CC.Utility;
using Garlic.BLL.Common;
using Garlic.DM.DataModel;
using Garlic.CC.WebUtility;
using Garlic.BLL;

public partial class SystemManagement_SysConfigAdd : BasePage
{
    

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.formSysConfig.DefaultMode = FormViewMode.Insert;
        }
    }

    private void ShowMessage(string msg)
    {
        this.Message = msg;
    }

    protected void TopToolBar_OnClick(object sender, Garlic.UI.Components.IconButtonClickEventArgs args)
    {
        try
        {
            switch (args.Command)
            {
                case ToolbarCommand.Save:
                    try
                    {
                        this.formSysConfig.InsertItem(true);
                        //如果没有出异常，说明插入成功
                        //立即关闭当前窗口
                        this.CloseVirtualWindow(true);
                    }
                    catch(Exception ex)
                    {
                        this.Message = ex.InnerException.Message;
                    }
                    break;
            }
        }
        catch (Exception ex)
        {
            this.HandleException(ex);
        }
    }
    protected void formSysConfig_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        e.Values["changeable"] = Convert.ToInt32(e.Values["changeable"]);
    }
}
